package com.yhy.wxzn.wcs.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;


@Getter
@AllArgsConstructor
public enum PortModel{
    IN_PORT(0, "入库"),
    OUT_PORT(1, "出库"),
    IN_AND_OUT(2, "出入混合模式"),
    TRANSFER_PORT(3, "移库"),
    BAN(4, "禁用");


    @EnumValue
    private final Integer num;
    @JsonValue
    private final String desc;



    @Override
    public String toString() {
        return desc;
    }



    /**
     * @param num
     * @return PortType
     */
    public static PortModel parsePortType(int num) {
        PortModel[] portTypes = PortModel.values();
        for (PortModel portType : portTypes) {
            if (portType.num == num) {
                return portType;
            }
        }
        throw new IllegalArgumentException("库口类型参数异常");
    }

}
